/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Id: LogEventListenerAppender.java 613 2007-05-14 12:21:10Z jacek.kolezynski $
 */
package logmatcher.analyzers;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;


/**
 * DOCUMENT ME!
 *
 * @version $Revision: 613 $
 */
public final class LogEventListenerAppender extends AppenderSkeleton {
    //~ Instance fields ------------------------------------------------------------------------------------------------


	Analyzer analyzer;
    //~ Constructors ---------------------------------------------------------------------------------------------------

    /**
     * Creates a new AnalyzerAppender object.
     *
     * @param listener DOCUMENT ME!
     */
    public LogEventListenerAppender(Analyzer analyzer) {
        super();
        this.analyzer = analyzer;
    }

    //~ Methods --------------------------------------------------------------------------------------------------------

    /**
     * DOCUMENT ME!
     *
     * @param arg0 DOCUMENT ME!
     */
    @Override
    protected void append(LoggingEvent event) {
        analyzer.receiveMessage(event);
    }


    /**
     * DOCUMENT ME!
     */
    @Override
    public void close() {
        // nothing to do
    }


    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    @Override
    public boolean requiresLayout() {
        return false;
    }
}
